//
//  QuickaboutDiagnosisofdiseaseTableViewCell.m
//  WE
//
//  Created by 要帅气的生活 on 15/11/21.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "QuickaboutDiagnosisofdiseaseTableViewCell.h"
#import "BaseView.h"
#import "QuickaboutViewController.h"

@interface QuickaboutDiagnosisofdiseaseTableViewCell ()

@property (nonatomic,strong) QuickaboutViewController *quick;

@end

@implementation QuickaboutDiagnosisofdiseaseTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _miaosu = [UILabel new];
        [self.contentView addSubview:_miaosu];
        _field = [UITextView new];
        [self.contentView addSubview:_field];
        
        _view = [BaseView new];
        [self.contentView addSubview:_view];
        
        _label = [UILabel new];
        [_field addSubview:_label];
        
//        _stern = [UILabel new];
//        [self.contentView addSubview:_stern];
//        
//        _left = [UIButton buttonWithType:UIButtonTypeSystem];
//        [_stern addSubview:_left];
//        
//        _right = [UIButton buttonWithType:UIButtonTypeSystem];
//        [_stern addSubview:_button];
//        
//        _button = [UIButton buttonWithType:UIButtonTypeSystem];
//        [_stern addSubview:_button];
        
    }
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    _miaosu.frame = CGRectMake(10, 10, self.frame.size.width/3, 20);
    _miaosu.text = @"病情描述";
    _miaosu.font = [UIFont systemFontOfSize:14];
    
    _field.frame = CGRectMake(10, 40, self.frame.size.width-20, self.frame.size.height/3*2);
    self.field.layer.cornerRadius = 6;
    self.field.layer.borderWidth = 2;
    _field.layer.borderColor = [UIColor redColor].CGColor;
    _field.textAlignment = 0;
    _field.font = [UIFont systemFontOfSize:14];
    //_field.delegate = self;
    
    if (WindowWidth < 375) {
        _label.frame = CGRectMake(10, -15, self.field.frame.size.width-20, self.field.frame.size.height);
    }else{
        _label.frame = CGRectMake(10, -20, self.field.frame.size.width-20, self.field.frame.size.height);
    }
    
    _label.font = _field.font;
    _label.numberOfLines = 0;
    _label.backgroundColor = [UIColor clearColor];
    _label.alpha = 0.3;
    
    
    //_stern.frame = CGRectMake(0, WindowHeight, WindowWidth, 40);
    
    
//    _button.frame = CGRectMake(_stern.frame.size.width-80, 0, 60, _stern.frame.size.height);
//    [_button setTitle:@"完成" forState:UIControlStateNormal];
//    [_button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
//    
//    _left.frame = CGRectMake(20, 10, 20, 20);
//    [_left setBackgroundImage:[UIImage imageNamed:@"zuo"] forState:UIControlStateNormal];
//    [_left addTarget:self action:@selector(lefts:) forControlEvents:UIControlEventTouchUpInside];
//    
//    _right.frame = CGRectMake(85, 10, 20, 20);
//    [_right setBackgroundImage:[UIImage imageNamed:@"you"] forState:UIControlStateNormal];
//    [_right addTarget:self action:@selector(rights:) forControlEvents:UIControlEventTouchUpInside];
}



-(void)btnClick:(UIButton *)button{
    NSRange range = NSMakeRange([self.field.text length] - 1, 1);
    [self.field scrollRangeToVisible:range];
    [self endEditing:YES];
}
- (void)textViewDidChange:(UITextView *)textView;

{
    if ([ToolUtil isBlank:textView.text]) {
        self.label.hidden = NO;
    }else {
        self.label.hidden = YES;
    }
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [super touchesBegan:touches withEvent:event];
    [self endEditing:YES];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
